package com.pt25.study.example.domain.sharding.service.impl;

import com.pt25.base.dep.redis.RedisService;
import com.pt25.base.model.common.constants.RedisConstant;
import com.pt25.study.example.domain.sharding.ddo.ShardingMs;
import com.pt25.study.example.domain.sharding.factory.ShardingFactory;
import com.pt25.study.example.domain.sharding.service.ShardingMsService;
import com.pt25.study.example.repository.sharding.persistence.ShardingMsRepo;
import com.pt25.study.example.repository.sharding.po.ShardingMsPo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class ShardingMsServiceImpl implements ShardingMsService {

    @Resource
    private ShardingFactory shardingFactory;

    @Resource
    private ShardingMsRepo shardingMsRepo;

    @Override
    public ShardingMs getShardingMs(Long id) {
        return shardingMsRepo.getShardingMs(id);
    }

    @Override
    public void addShardingMs(ShardingMs shardingMs) {
        shardingMsRepo.save(shardingFactory.ShardingMs2ShardingMsPo(shardingMs));
    }
}
